<template>
  <div class="goods-comment">
    <div class="head">
      <div class="data">
       <p>
      <span>{{ commentList.salesCount }}</span
      ><span>人购买</span>
    </p>
    <p>
      <span>{{ commentList.praisePercent }}</span
      ><span>好评率</span>
    </p>
    <p>
      <span>{{ commentList.evaluateCount }}</span
      ><span>条评价</span>
    </p>
    <p>
      <span>{{ commentList.hasPictureCount}}</span>
      <span>条有图评价</span>
    </p>
      </div>
    </div>
  </div>
</template>
<script>
import { findCommentInfoByGoods } from '@/api/good'
import { onMounted, ref } from 'vue'
export default {
  name: 'GoodsComment',
  setup () {
    const commentList = ref({})
    async function loadCommentList () {
      const res = await findCommentInfoByGoods()
      commentList.value = res.result
      console.log(res, '评论')
    }
    onMounted(() => {
      loadCommentList()
    })
    return {
      commentList

    }
  }
}
</script>
<style scoped lang="less">
.goods-comment {
  .head {
    display: flex;
    padding: 30px 0;
    .data {
      flex:1;
      display: flex;
      padding: 20px;
      p {
        flex: 1;
        text-align: center;
        span {
          display: block;
          &:first-child {
            font-size: 32px;
            color: @priceColor;
          }
          &:last-child {
            color: #999;
          }
        }
      }
    }
  }
  .sort {
    height: 60px;
    line-height: 60px;
    border-top: 1px solid #f5f5f5;
    border-bottom: 1px solid #f5f5f5;
    margin: 0 20px;
    color: #666;
    > span {
      margin-left: 20px;
    }
    > a {
      margin-left: 30px;
      &.active,
      &:hover {
        color: @xtxColor;
      }
    }
  }
}
.list {
  padding: 0 20px;
  .item {
    display: flex;
    padding: 25px 10px;
    border-bottom: 1px solid #f5f5f5;
    .user {
      width: 160px;
      img {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        overflow: hidden;
      }
      span {
        padding-left: 10px;
        color: #666;
      }
    }
    .body {
      flex: 1;
      .score {
        line-height: 40px;
        .iconfont {
          color: #ff9240;
          padding-right: 3px;
        }
        .attr {
          padding-left: 10px;
          color: #666;
        }
      }
    }
    .text {
      color: #666;
      line-height: 24px;
    }
    .time {
      color: #999;
      display: flex;
      justify-content: space-between;
      margin-top: 5px;
    }
  }
}
</style>
